home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2010 Summer - Disc 1
/
WN_Ete2010_CD1.iso
/
Onglet5
/
Weezo
/
Weezo setup.exe
/
{code_appDir}
/
www
/
res
/
administration
/
std
/
mobileGeneral.php
< prev
next >
Wrap
PHP Script
|
2010-05-19
|
7KB
|
162 lines
<?php
/**
* General options configuration for mobiles
*
* this script is included by index.php and shouldn't be directly called
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category NA
* @package NA
* @author Nicolas Bruley / Peer 2 World <contact@weezo.net>
* @copyright 2005-2009 Nicolas Bruley / Peer 2 World
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
* @link http://www.weezo.net
* @since File available since Release 1.4.0
*/
require(INCLUDE_DIR.'mobileFunctions.php');
require_once(INCLUDE_DIR.'resourceConfigFunctions.php');
// Set this value to true to indicate not to display HTML page and JS Stuff (used when dumping a log to output)
$displayFinished=false;
/*
* Verify access rights
*/
if($_SERVER['REMOTE_ADDR']!='127.0.0.1'){
if(cfUGetVar('administrator')!=true || !cfGGetVar('remoteAdministrationAuthorized')) outDisplayErrorPage(cfcaption('errorRemoteAdministrationNotAuthorized'));
}
/*
***************************************************************************************************************************
* Insert HEAD, FORMS and JAVASCRIPT functions
***************************************************************************************************************************
*/
mfInsertHead();
require(dirname($_SERVER['SCRIPT_FILENAME']).'/general.php');
if($displayFinished) exit;
/*
***************************************************************************************************************************
* Display general tab
***************************************************************************************************************************
*/
// Misc advanced admin actions
if(cfRGetVar('advancedAdministration')){
echo outDivFrame('frame2');
echo mfListTable();
// Remote desktop
echo mfListSpacer(cfCaption('remoteDesktop'));
echo mfListItem('onclick="document.location=\''.$_SERVER['PHP_SELF'].'?panel=remoteDesktop\'"',outImage(outIcon('desktop32'),false,'class="frLi2"'),false,cfCaption('remoteDesktop'));
// Dos prompt
echo mfListSpacer(cfCaption('dosPrompt'));
echo mfListItem('onclick="document.location=\''.$_SERVER['PHP_SELF'].'?panel=prompt\'"',outImage(outIcon('prompt32'),false,'class="frLi2"'),false,cfCaption('dosPrompt'));
// Server Restart / Shutdown
echo mfListSpacer(cfCaption('mainServer'));
echo mfListItem('onclick="restartServer()"',outImage('serverRestart.png',false,'class="frLi2"'),false,cfCaption('adminRestart'));
echo mfListItem('onclick="stopServer()"',outImage('serverShutdown.png',false,'class="frLi2"'),false,cfCaption('adminComputerShutdown'));
// Computer turn off / restart
echo mfListSpacer(cfCaption('adminComputer'));
echo mfListItem('onclick="restartComputer()"',outImage('computerRestart.png',false,'class="frLi2"'),false,cfCaption('adminRestart'));
echo mfListItem('onclick="stopComputer()"',outImage('computerShutdown.png',false,'class="frLi2"'),false,cfCaption('adminComputerShutdown'));
// Weezo reboot
echo mfListSpacer('Weezo');
echo mfListItem('onclick="restartWeezo()"',outImage(outIcon('appIcon32'),false,'class="frLi2"'),false,cfCaption('adminRestart'));
echo '</table>';
}
// Connected users
$nb=0;
$sessions=glob(cfAppDataDir().'/sessiondata/sess_*');
$out='';
foreach ($sessions as $completeFilename){
$file=basename($completeFilename);
if($isCurrentUser=($file=='sess_'.wSession_id())){
$out.=mfListItem('',outImage('/gfx/icons/'.cfUGetVar('icon'),false,'class="frLi2"'),false,'<div class="lit">'.cfUTF8Encode(cfUGetVar('name')).'</div>'.cfCaption('activityConnectedSince').' '.cfUTF8Encode(@date(cfCaption('_FULL_DATE_FORMAT'),$_SESSION['connectionTime'])));
$nb++;
}
else{
$sess=cfUnserializeSession(file_get_contents($completeFilename));
if(isset($sess['user']['name']) && isset($sess['accountIP']) && isset($sess['connectionTime'])){
$out.=mfListItem('onclick="javascript:disconnect(\''.$file.'\')"',outImage(outIcon('logout'),false,'class="frLi2"'),false,'<div class="lit">'.cfUTF8Encode($sess['user']['name']).'</div>'.cfCaption('activityConnectedSince').' '.cfUTF8Encode(@date(cfCaption('_FULL_DATE_FORMAT'),$sess['connectionTime'])));
$nb++;
}
unset($sess);
}
}
// Display connected users (only if any)
if($nb){
echo outDivFrame('frame2');
echo mfListTable();
echo mfListSpacer(cfCaption('adminConnectedUsers').cfCaption('genSeparator').cfCaption('mainNumberConnectedUsers',$nb));
echo $out.'</table>';
echo '</div>';
}
echo outDivFrame('frame1');
//echo '<div class="frame1Header">'.outThemeImage(outicon('config'),false,false,'margin-right:1em').cfCaption('adminGeneral').'</div>';
// Bittorrent seeder
echo outDivFrame('frame2');
echo mfListTable();
echo mfListSpacer(cfCaption('bittorrent'));
// If enabled, ping seeder to verify it's actually responding
if(cfGGetVar('bittorrentEnabled')) {
echo mfListItem(false,outImage(outIcon('isOn'),false,'class="frLi16"'),false,'<div class="lit">'.cfCaption('bittorrent').'</div>'.cfCaption('genActivated'),false,false,false);
// Ping seeder
if($sock=@fsockopen('127.0.0.1',cfGGetVar('bittorrentPort'),$errno,$errstr,3)){
fclose($sock);
echo mfListItem(false,outImage(outIcon('isOn'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivated'),false,false,false);
}
else {
echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivatedFalse'),false,false,false);
}
}
else {
echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">'.cfCaption('bittorrent').'</div>'.cfCaption('genActivatedFalse'),false,false,false);
echo mfListItem(false,outImage(outIcon('isOff'),false,'class="frLi16"'),false,'<div class="lit">Seeder</div>'.cfCaption('genActivatedFalse'),false,false,false);
}
echo "</table></div>\n";
// Logs
echo mfListTable();
echo mfListSpacer(cfCaption('activityLogs'));
echo mfListItem('onclick="logApacheAccess()"',outImage(outIcon('apache'),false,'class="frLi2"'),false,cfCaption('logApache'),false,outImage(outIcon('go')));
echo mfListItem('onclick="logApacheError()"',outImage(outIcon('bugs'),false,'class="frLi2"'),false,cfCaption('logApacheError'),false,outImage(outIcon('go')));
echo mfListItem('onclick="logApplication()"',outImage(outIcon('appIcon32'),false,'class="frLi2"'),false,cfCaption('logApplication'),false,outImage(outIcon('go')));
echo '</table>';
echo "</div>\n";
?>